/**
 * author:wos
 * time:2024-1-4
 * title:查询字典值
 */
const parseQueryParams = require("../../utils/parseQueryParams");

async function list(ctx, next) {
    const url = ctx.request.url
    const selectJson = parseQueryParams(url)
    const sql = `SELECT * FROM sys_dict_data WHERE dictType = "${selectJson.key}" AND status = '0' ORDER BY dictSort desc`
    try {
        const rs = await global.query(sql)
        global.response(ctx, {
            "status":200,
            "code": 200,
            "data": rs,
            "msg":'success'
        })
    } catch (err) {
        global.serverError(ctx)
    }
}
module.exports = list


